﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Main_Inventory_MainPurchaseInvoice : System.Web.UI.Page
{
    Datautility DU = new Datautility();
    string strsql = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Poid"] != null)
        {
            strsql = "Select * from IVR_TRANFORMAT where trantype=4";
            DataTable DT = DU.getdata(strsql);
            if (DT.Rows.Count > 0)
            {
                if (Convert.ToInt32(DT.Rows[0]["taxatitem"]) == 0 && Convert.ToInt32(DT.Rows[0]["discatitem"]) == 0)
                {
                    Response.Redirect("PurInvoiceWithBillLevel.aspx?Poid=" + Request.QueryString["Poid"].ToString());
                }
                else if (Convert.ToInt32(DT.Rows[0]["taxatitem"]) == 1 && Convert.ToInt32(DT.Rows[0]["discatitem"]) == 0)
                {
                    Response.Redirect("PurInvoiceWithItemLevel.aspx?Poid=" + Request.QueryString["Poid"].ToString() + "&Currency=" + Request.QueryString["Currency"].ToString());
                }
            }
            else
            {
                Response.Redirect("PurchasedReceived.aspx?Msg=no");
            }
        
        }
        
    }
}
